package com.yjt.fresh.activity;

import android.app.Dialog;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yjt.fresh.R;
import com.yjt.fresh.base.BaseSimpleActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 联系我们
 * Created by mcc on 2018/7/21.
 */

public class AtyContactUs extends BaseSimpleActivity {
    @BindView(R.id.back)
    RelativeLayout mBack;
    @BindView(R.id.rlAppAtyContactUsPhone)
    RelativeLayout mRlPhone;

    @Override
    protected int getContentView() {
        return R.layout.app_aty_contact_us;
    }

    @Override
    protected void initViews() {
        ButterKnife.bind(this);
    }

    @Override
    protected void initEvent() {
        mBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        mRlPhone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                loginDialog();
            }
        });
    }

    private void loginDialog() {
        final Dialog dialog = new Dialog(mContext, R.style.MyDialog);
        dialog.setContentView(R.layout.app_dialog_sure_cancel);
        TextView tvContent = dialog.findViewById(R.id.tvAppDIalogSureCancelContent);
        TextView tvCancel = dialog.findViewById(R.id.tvAppDialogSureCancelCancel);
        TextView tvSure = dialog.findViewById(R.id.tvAppDialogSureCancelSure);
        TextView tvTitle = dialog.findViewById(R.id.tvAppDIalogSureCancelTitle);
        tvTitle.setVisibility(View.VISIBLE);
        tvTitle.setText("即将拨通客服电话哦");
        tvContent.setText("4000657001");
        tvCancel.setText("取消");
        tvSure.setText("立即拨打");
        tvCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (dialog != null && dialog.isShowing()) {
                    dialog.dismiss();
                }
            }
        });
        tvSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showMobileDialerInterface("4000657001");
                if (dialog != null && dialog.isShowing()) {
                    dialog.dismiss();
                }
            }
        });
        dialog.show();
    }

}
